﻿using RestSharp;
using Ymatou.API.Common;
using Ymatou.Evaluate.Buyer.Model.ApiModel.Response.Operator;
using Ymatou.ServiceCenter;

namespace Ymatou.Evaluate.Buyer.Model.ApiModel.Request.Operator
{
    /// <summary>
    /// 删除评价
    /// </summary>
    [Resource("bevaluateo.iapi.ymatou.com", "api/RemoveEvaluate", Method.POST, ParameterBuildType.Json)]
    public class RemoveEvaluateRequest : BaseRequestModel<RemoveEvaluateResponse>
    {
        public override string ApiName { get { return "api/RemoveEvaluate"; } }
        public override bool HttpGet { get { return false; } }

        /// <summary>
        /// 买家Id
        /// </summary>
        public int BuyerId { get; set; }

        /// <summary>
        /// 商品评价Id
        /// </summary>
        public int ProdEvalId { get; set; }

        /// <summary>
        /// 商品Id
        /// </summary>
        public string ProductId { get; set; }

        public override void Validate()
        {
            const string errCode = "-1";
            if (BuyerId <= 0)
            {
                throw new BussniessException(errCode, "买家Id非法");
            }
            if (ProdEvalId <= 0)
            {
                throw new BussniessException(errCode, "商品评价Id非法");
            }
            if (string.IsNullOrEmpty(ProductId))
            {
                throw new BussniessException(errCode, "商品Id非法");
            }
            base.Validate();
        }
    }
}
